package com.ibm.risk.irmp.workflow.client.flowable.api;

import com.ibm.risk.irmp.workflow.client.flowable.ApiClient;

import com.ibm.risk.irmp.workflow.client.flowable.model.CommentResponse;
import com.ibm.risk.irmp.workflow.client.flowable.model.DataResponseHistoricProcessInstanceResponse;
import com.ibm.risk.irmp.workflow.client.flowable.model.HistoricIdentityLinkResponse;
import com.ibm.risk.irmp.workflow.client.flowable.model.HistoricProcessInstanceQueryRequest;
import com.ibm.risk.irmp.workflow.client.flowable.model.HistoricProcessInstanceResponse;
import java.time.OffsetDateTime;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;


@Component("com.ibm.risk.irmp.flowable.api.HistoryProcessApi")
public class HistoryProcessApi {
    private ApiClient apiClient;

    public HistoryProcessApi() {
        this(new ApiClient());
    }

    @Autowired
    public HistoryProcessApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Create a new comment on a historic process instance
     * Parameter saveProcessInstanceId is optional, if true save process instance id of task with comment.
     * <p><b>200</b> - successful operation
     * <p><b>201</b> - Indicates the comment was created and the result is returned.
     * <p><b>400</b> - Indicates the comment is missing from the request.
     * <p><b>404</b> - Indicates that the historic process instance could not be found.
     * @param processInstanceId The processInstanceId parameter
     * @param body The body parameter
     * @return CommentResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public CommentResponse createComment(String processInstanceId, CommentResponse body) throws RestClientException {
        Object postBody = body;

        // verify the required parameter 'processInstanceId' is set
        if (processInstanceId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processInstanceId' when calling createComment");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processInstanceId", processInstanceId);
        String path = UriComponentsBuilder.fromPath("/history/historic-process-instances/{processInstanceId}/comments").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<CommentResponse> returnType = new ParameterizedTypeReference<CommentResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Delete a comment on a historic process instance
     *
     * <p><b>204</b> - Indicates the historic process instance and comment were found and the comment is deleted. Response body is left empty intentionally.
     * <p><b>404</b> - Indicates the requested historic process instance was not found or the historic process instance does not have a comment with the given ID.
     * @param processInstanceId The processInstanceId parameter
     * @param commentId The commentId parameter
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void deleteComment(String processInstanceId, String commentId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processInstanceId' is set
        if (processInstanceId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processInstanceId' when calling deleteComment");
        }

        // verify the required parameter 'commentId' is set
        if (commentId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'commentId' when calling deleteComment");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processInstanceId", processInstanceId);
        uriVariables.put("commentId", commentId);
        String path = UriComponentsBuilder.fromPath("/history/historic-process-instances/{processInstanceId}/comments/{commentId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     *  Delete a historic process instance
     *
     * <p><b>204</b> - Indicates that the historic process instance was deleted.
     * <p><b>404</b> - Indicates that the historic process instance could not be found.
     * @param processInstanceId The processInstanceId parameter
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void deleteHistoricProcessInstance(String processInstanceId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processInstanceId' is set
        if (processInstanceId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processInstanceId' when calling deleteHistoricProcessInstance");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processInstanceId", processInstanceId);
        String path = UriComponentsBuilder.fromPath("/history/historic-process-instances/{processInstanceId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a comment on a historic process instance
     *
     * <p><b>200</b> - Indicates the historic process instance and comment were found and the comment is returned.
     * <p><b>404</b> - Indicates the requested historic process instance was not found or the historic process instance does not have a comment with the given ID.
     * @param processInstanceId The processInstanceId parameter
     * @param commentId The commentId parameter
     * @return CommentResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public CommentResponse getComment(String processInstanceId, String commentId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processInstanceId' is set
        if (processInstanceId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processInstanceId' when calling getComment");
        }

        // verify the required parameter 'commentId' is set
        if (commentId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'commentId' when calling getComment");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processInstanceId", processInstanceId);
        uriVariables.put("commentId", commentId);
        String path = UriComponentsBuilder.fromPath("/history/historic-process-instances/{processInstanceId}/comments/{commentId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<CommentResponse> returnType = new ParameterizedTypeReference<CommentResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a historic process instance
     *
     * <p><b>200</b> - Indicates that the historic process instances could be found.
     * <p><b>404</b> - Indicates that the historic process instances could not be found.
     * @param processInstanceId The processInstanceId parameter
     * @return HistoricProcessInstanceResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public HistoricProcessInstanceResponse getHistoricProcessInstance(String processInstanceId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processInstanceId' is set
        if (processInstanceId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processInstanceId' when calling getHistoricProcessInstance");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processInstanceId", processInstanceId);
        String path = UriComponentsBuilder.fromPath("/history/historic-process-instances/{processInstanceId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<HistoricProcessInstanceResponse> returnType = new ParameterizedTypeReference<HistoricProcessInstanceResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get the binary data for a historic process instance variable
     * The response body contains the binary value of the variable. When the variable is of type binary, the content-type of the response is set to application/octet-stream, regardless of the content of the variable or the request accept-type header. In case of serializable, application/x-java-serialized-object is used as content-type.
     * <p><b>200</b> - Indicates the process instance was found and the requested variable data is returned.
     * <p><b>404</b> - Indicates the requested process instance was not found or the process instance does not have a variable with the given name or the variable does not have a binary stream available. Status message provides additional information.
     * @param processInstanceId The processInstanceId parameter
     * @param variableName The variableName parameter
     * @return List&lt;byte[]&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<byte[]> getHistoricProcessInstanceVariableData(String processInstanceId, String variableName) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processInstanceId' is set
        if (processInstanceId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processInstanceId' when calling getHistoricProcessInstanceVariableData");
        }

        // verify the required parameter 'variableName' is set
        if (variableName == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'variableName' when calling getHistoricProcessInstanceVariableData");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processInstanceId", processInstanceId);
        uriVariables.put("variableName", variableName);
        String path = UriComponentsBuilder.fromPath("/history/historic-process-instances/{processInstanceId}/variables/{variableName}/data").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<byte[]>> returnType = new ParameterizedTypeReference<List<byte[]>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List comments on a historic process instance
     *
     * <p><b>200</b> - Indicates the process instance was found and the comments are returned.
     * <p><b>404</b> - Indicates that the historic process instance could not be found.
     * @param processInstanceId The processInstanceId parameter
     * @return List&lt;CommentResponse&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<CommentResponse> listHistoricProcessInstanceComments(String processInstanceId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processInstanceId' is set
        if (processInstanceId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processInstanceId' when calling listHistoricProcessInstanceComments");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processInstanceId", processInstanceId);
        String path = UriComponentsBuilder.fromPath("/history/historic-process-instances/{processInstanceId}/comments").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<CommentResponse>> returnType = new ParameterizedTypeReference<List<CommentResponse>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List identity links of a historic process instance
     *
     * <p><b>200</b> - Indicates request was successful and the identity links are returned
     * <p><b>404</b> - Indicates the process instance could not be found..
     * @param processInstanceId The processInstanceId parameter
     * @return List&lt;HistoricIdentityLinkResponse&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<HistoricIdentityLinkResponse> listHistoricProcessInstanceIdentityLinks(String processInstanceId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processInstanceId' is set
        if (processInstanceId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processInstanceId' when calling listHistoricProcessInstanceIdentityLinks");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processInstanceId", processInstanceId);
        String path = UriComponentsBuilder.fromPath("/history/historic-process-instances/{processInstanceId}/identitylinks").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<HistoricIdentityLinkResponse>> returnType = new ParameterizedTypeReference<List<HistoricIdentityLinkResponse>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List of historic process instances
     *
     * <p><b>200</b> - Indicates that historic process instances could be queried.
     * <p><b>400</b> - Indicates an parameter was passed in the wrong format. The status-message contains additional information.
     * @param processInstanceId An id of the historic process instance.
     * @param processInstanceName A name of the historic process instance.
     * @param processInstanceNameLike A name of the historic process instance used in a like query.
     * @param processInstanceNameLikeIgnoreCase A name of the historic process instance used in a like query ignoring case.
     * @param processDefinitionKey The process definition key of the historic process instance.
     * @param processDefinitionId The process definition id of the historic process instance.
     * @param processDefinitionName The process definition name of the historic process instance.
     * @param processDefinitionCategory The process definition category of the historic process instance.
     * @param processDefinitionVersion The process definition version of the historic process instance.
     * @param deploymentId The deployment id of the historic process instance.
     * @param businessKey The business key of the historic process instance.
     * @param businessKeyLike Only return instances with a businessKey like this key.
     * @param involvedUser An involved user of the historic process instance.
     * @param finished Indication if the historic process instance is finished.
     * @param superProcessInstanceId An optional parent process id of the historic process instance.
     * @param excludeSubprocesses Return only historic process instances which are not sub processes.
     * @param finishedAfter Return only historic process instances that were finished after this date.
     * @param finishedBefore Return only historic process instances that were finished before this date.
     * @param startedAfter Return only historic process instances that were started after this date.
     * @param startedBefore Return only historic process instances that were started before this date.
     * @param startedBy Return only historic process instances that were started by this user.
     * @param includeProcessVariables An indication if the historic process instance variables should be returned as well.
     * @param callbackId Only return instances with the given callbackId.
     * @param callbackType Only return instances with the given callbackType.
     * @param tenantId Only return instances with the given tenantId.
     * @param tenantIdLike Only return instances with a tenantId like the given value.
     * @param withoutTenantId If true, only returns instances without a tenantId set. If false, the withoutTenantId parameter is ignored.
     * @return DataResponseHistoricProcessInstanceResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public DataResponseHistoricProcessInstanceResponse listHistoricProcessInstances(String processInstanceId, String processInstanceName, String processInstanceNameLike, String processInstanceNameLikeIgnoreCase, String processDefinitionKey, String processDefinitionId, String processDefinitionName, String processDefinitionCategory, String processDefinitionVersion, String deploymentId, String businessKey, String businessKeyLike, String involvedUser, Boolean finished, String superProcessInstanceId, Boolean excludeSubprocesses, OffsetDateTime finishedAfter, OffsetDateTime finishedBefore, OffsetDateTime startedAfter, OffsetDateTime startedBefore, String startedBy, Boolean includeProcessVariables, String callbackId, String callbackType, String tenantId, String tenantIdLike, Boolean withoutTenantId) throws RestClientException {
        Object postBody = null;

        String path = UriComponentsBuilder.fromPath("/history/historic-process-instances").build().toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceId", processInstanceId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceName", processInstanceName));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceNameLike", processInstanceNameLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceNameLikeIgnoreCase", processInstanceNameLikeIgnoreCase));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionKey", processDefinitionKey));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionId", processDefinitionId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionName", processDefinitionName));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionCategory", processDefinitionCategory));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionVersion", processDefinitionVersion));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "deploymentId", deploymentId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "businessKey", businessKey));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "businessKeyLike", businessKeyLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "involvedUser", involvedUser));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "finished", finished));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "superProcessInstanceId", superProcessInstanceId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "excludeSubprocesses", excludeSubprocesses));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "finishedAfter", finishedAfter));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "finishedBefore", finishedBefore));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "startedAfter", startedAfter));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "startedBefore", startedBefore));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "startedBy", startedBy));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "includeProcessVariables", includeProcessVariables));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "callbackId", callbackId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "callbackType", callbackType));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "tenantId", tenantId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "tenantIdLike", tenantIdLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "withoutTenantId", withoutTenantId));

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<DataResponseHistoricProcessInstanceResponse> returnType = new ParameterizedTypeReference<DataResponseHistoricProcessInstanceResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Query for historic process instances
     * All supported JSON parameter fields allowed are exactly the same as the parameters found for getting a collection of historic process instances, but passed in as JSON-body arguments rather than URL-parameters to allow for more advanced querying and preventing errors with request-uri’s that are too long. On top of that, the query allows for filtering based on process variables. The variables property is a JSON-array containing objects with the format as described here.
     * <p><b>200</b> - Indicates request was successful and the process instances are returned
     * <p><b>400</b> - Indicates an parameter was passed in the wrong format. The status-message contains additional information.
     * @param body The body parameter
     * @return DataResponseHistoricProcessInstanceResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public DataResponseHistoricProcessInstanceResponse queryHistoricProcessInstance(HistoricProcessInstanceQueryRequest body) throws RestClientException {
        Object postBody = body;

        String path = UriComponentsBuilder.fromPath("/query/historic-process-instances").build().toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<DataResponseHistoricProcessInstanceResponse> returnType = new ParameterizedTypeReference<DataResponseHistoricProcessInstanceResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
}
